<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>选择器权重案例</title>
        <style>
        #content div#main-content h2{color:red;}

        #content #main-content>h2{color:blue}

        body #content div[id="main-content"] h2{color:green;}

        #main-content div.paragraph h2{color:orange;}

        #main-content [class="paragraph"] h2{color:yellow;}

        div#main-content div.paragraph h2.first{color:pink;} 
    </style>
    </head>
    <body>
        <!-- content -->
        <div id="content">
            <div id="main-content">
                <h2>标题1</h2>
                <p>test1</p>
                <div class="paragraph">
                    <h2 class="first">标题2</h2>
                    <p>test2</p>
                </div>
            </div>
        </div>
    </body>
</html>